<?php
	include_once 'isLogin.php';	
	$userc=new user();
	$table= 'user_message';  	  		 	  //咨询表
	$table_list= 'user_message_list';  	  	  //关联表


	if($_GET['action']=="del"){
		$commonc->del($table,$_POST['id']);
		//删除关联表
		echo $commonc->del($table_list,$_POST['id'],'','msg_id');	
		exit();
	}

	
	if($_POST){
		$where=" AND m.title like '%".$_POST['title']."%'";
		$smarty->assign('search',$_POST);
	}

	$message=$userc->message_list($where);
	$page=$message['page'];
	$message=$message['result'];
	for ($i=0; $i <count($message) ; $i++) { 
		@$message[$i]['create_time']=date('Y-m-d H:i:s',$message[$i]['create_time']);
	}
	
	$smarty->assign("message",$message);
	$smarty->assign('pages',$page);
	$smarty->display("user_message_list.html");
?>